{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "af4010d21633403b96131acdab70604c",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Plot(antialias=3, axes=['x', 'y', 'z'], background_color=16777215, camera=[1.9422936569463958, 2.3991068775795…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "\"\"\"\n",
    "Stream tubes originating from a probing grid of points.\n",
    "Data is from CFD analysis of airflow in an office with\n",
    "ventilation and a burning cigarette.\n",
    "\"\"\"\n",
    "# see original script at:\n",
    "# https://github.com/Kitware/VTK/blob/master/Examples/\n",
    "#  VisualizationAlgorithms/Python/officeTube.py\n",
    "from vtkplotter import *\n",
    "from office_furniture import furniture\n",
    "\n",
    "\n",
    "# We read a data file the is a CFD analysis of airflow in an office\n",
    "# (with ventilation and a burning cigarette).\n",
    "sgrid = loadStructuredGrid(datadir + \"office.binary.vtk\")\n",
    "\n",
    "\n",
    "# Now we will generate multiple streamlines in the data. We create a\n",
    "# grid of points of points and then use those as integration seeds.\n",
    "seeds = Grid(pos=[2,2,1], normal=[1,0,0], resx=2, resy=3, c=\"gray\")\n",
    "\n",
    "# We select the integration order to use (RungeKutta order 4) and\n",
    "# associate it with the streamer. We integrate in the forward direction.\n",
    "slines = streamLines(\n",
    "                    sgrid, seeds,\n",
    "                    integrator=\"rk4\",\n",
    "                    direction=\"forward\",\n",
    "                    initialStepSize=0.01,\n",
    "                    maxPropagation=15,\n",
    "                    tubes={\"radius\":0.004, \"varyRadius\":2, \"ratio\":1},\n",
    "                    )\n",
    "\n",
    "show(slines, seeds)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
